﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace delegateStudy
{
    class Program
    {
        delegate double  Cal(double x, double y);
        
        static double Add(double x,double y)
        {
            return x + y;
        }
        static void Main(string[] args)
        {
            Cal cal = new Cal(Mul);

            Console.WriteLine(cal(4, 5).ToString());

            Console.ReadKey();

            Func<double, double, double> func = (x, y) => x * y;

            Console.WriteLine(func(5, 6).ToString());

            Console.ReadKey();

            Cal calTmp = delegate (double x, double y)
              {
                  return x / y;
              };
            
            Console.WriteLine(calTmp(4, 5).ToString());

            Console.ReadKey();
            
        }

        static double Mul(double x, double y)
        {
            return x - y;
        }
    }







}
